package com.thon.service.system.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thon.dao.system.MenuDao;
import com.thon.dao.util.Page;
import com.thon.entity.system.Menu;
import com.thon.service.system.MenuService;


@Service
@Transactional
public class MenuServiceImpl implements MenuService{

	@Autowired
	private MenuDao menuDao;		
	


	@Override
	public Menu read(Integer id) {		
		
	    return menuDao.get(id);
	}

	@Override
	public String create(Menu Menu) {
		String msg = "success";		
		menuDao.save(Menu);
		return msg;
	}

	@Override
	public String delete(Integer id) {
		String msg = "success";		
		menuDao.delete(id);
		return msg;
	}

	@Override
	public String update(Menu Menu) {
		String msg = "success";		
		menuDao.update(Menu);
		return msg;
	}

	@Override
	public List<Menu> readList() {
	
			return menuDao.readList();
	
	}

	@Override
	public Page<Menu> readListPage(Integer pageNo, Integer pageSize) {
		Page<Menu> page = new Page<Menu>();
		page.setPageNo(pageNo);
		page.setPageSize(pageSize);		
		return menuDao.readListPage(page);
	}

	@Override
	public List<Menu> readList(String by, Integer val) {
		
		return menuDao.readList(by,val);
	}

	

}